Skip to content

Conversation

@JacksonMei
Copy link
Collaborator

  1. fix aenv instance bug
  2. show better list table
  3. Support deploy a service application with specified port and storage via aenv cli

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @JacksonMei, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a major new capability to the aenv CLI, allowing users to deploy and manage persistent service applications. This feature set includes commands for creating, listing, retrieving details, updating, and deleting services, with robust support for configuring replicas, ports, environment variables, and persistent storage. The changes span across the CLI, API service, and Kubernetes controller components, ensuring a seamless end-to-end experience. Additionally, the PR enhances the overall user experience through improved CLI output formatting, more informative error messages, and better internal code organization.

Highlights

  • New aenv service CLI Command: Introduced a comprehensive new CLI command group aenv service for managing long-running applications. This includes subcommands for create, list, get, delete, and update services.
  • Service Deployment with Storage and Configuration: The aenv service create command now supports deploying applications with specified replicas, custom ports, environment variables, and optional persistent storage (Persistent Volume Claims - PVCs). Resource limits (CPU, memory, ephemeral storage) can also be configured.
  • Enhanced CLI Output and Error Handling: The CLI output for listing instances and services has been significantly improved using the rich library, providing better readability and visual formatting. API error messages are now more user-friendly, offering clearer guidance for issues like authentication or connection failures.
  • Refactored API and CLI Utilities: Common API interaction helpers and environment variable parsing logic have been centralized into a new cli.utils.api_helpers.py module, promoting code reuse and consistency across CLI commands. Logging configuration is also now more flexible.
  • Kubernetes Integration for Services: The backend API service and Kubernetes controller have been extended to handle the lifecycle of EnvService objects, translating CLI commands into Kubernetes Deployments, Services, and PVCs. This includes dynamic template merging for resource creation and updates.
  • Environment Name Validation: The aenv init command now includes validation for environment names to ensure they adhere to Kubernetes naming conventions, preventing potential deployment issues.
  • Bug Fix: Expired Pod Listing: Fixed a bug in the Kubernetes controller where all pods were incorrectly being marked as expired, regardless of their actual TTL status. Now, only truly expired pods are identified for cleanup.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces significant new functionality to support deploying service applications, a major enhancement to the aenv CLI. The changes are extensive, spanning the Python CLI, Go backend services, and Kubernetes configurations. Overall, the implementation is solid. I particularly appreciate the refactoring in the CLI, which has greatly improved code organization, error handling, and user experience with better table formatting and more informative error messages. The backend changes to support services, including the new controllers and models, are well-structured. I've identified a few areas for improvement, mainly concerning consistency in error handling and retry logic in the client, code duplication in the new CLI commands, and a hardcoded value in the Kubernetes configuration that could affect portability. Addressing these points will further enhance the quality and robustness of this new feature.

Comment on lines 549 to 550
else:
return []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This method silently returns an empty list [] when the API call is unsuccessful (i.e., api_response.success is false). This can be misleading for the caller, as it hides potential issues like authentication failures or server-side errors, making them indistinguishable from the case where no services actually exist. This behavior is inconsistent with other methods like get_env_service which raise an EnvironmentError. To ensure robust error handling, this should be changed to raise an EnvironmentError with the error message from the API response.

Suggested change
else:
return []
else:
error_msg = api_response.get_error_message()
raise EnvironmentError(f"Failed to list services: {error_msg}")

) from e

except httpx.RequestError as e:
import random
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The import random statement is located inside an except block. According to PEP 8, imports should generally be at the top of the file. This improves readability and makes dependencies clear. Please move this import to the top of the file.


except httpx.RequestError as e:
if attempt < self.max_retries:
wait_time = 2**attempt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The retry backoff logic is inconsistent across different methods in this class. The create_env_service method uses exponential backoff with jitter (2**attempt + random.uniform(0, 1)), which is a best practice to prevent thundering herd issues. However, this method and others (list_env_services, delete_env_service, update_env_service) use simple exponential backoff without jitter. For consistency and robustness, I recommend applying the same jittered backoff strategy to all retry mechanisms in this client.

Suggested change
wait_time = 2**attempt
wait_time = 2**attempt + random.uniform(0, 1)

Comment on lines +46 to +61
def _load_env_config() -> Optional[Dict[str, Any]]:
"""Load build configuration from config.json in current directory.

Returns:
Dictionary containing build configuration, or None if not found.
"""
config_path = Path(".").resolve() / "config.json"
if not config_path.exists():
return None

try:
with open(config_path, "r") as f:
config = json.load(f)
return config
except Exception:
return None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The helper function _load_env_config is duplicated here and in aenv/src/cli/cmds/instance.py. To improve code reuse and maintainability, this function should be moved to a shared utility module, such as aenv/src/cli/utils/api_helpers.py, and imported where needed. The same applies to the _get_system_url function.

Comment on lines 361 to 366
except Exception as e:
console.print(f"[red]❌ Creation failed:[/red] {str(e)}")
if cfg.verbose:
import traceback
console.print(traceback.format_exc())
raise click.Abort()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The exception handling in the create, delete, and update commands is very generic, catching Exception and printing a general failure message. This contrasts with the more detailed error handling in the list and get commands in this file, and in the refactored instance command, which provide specific, user-friendly feedback for common issues like authentication or connection errors. I recommend enhancing the error handling here to catch specific exceptions and provide more informative messages to the user, which will significantly improve the CLI's usability.

spec:
accessModes:
- ReadWriteOnce
storageClassName: alilocal-ssd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The storageClassName is hardcoded to alilocal-ssd. This reduces the portability of the Helm chart, as it will fail in Kubernetes clusters that do not have this specific StorageClass. It's better to either omit this field to use the cluster's default StorageClass, or make it a configurable value in values.yaml.

Copy link
Collaborator

@kangoal kangoal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

JacksonMei and others added 2 commits January 19, 2026 10:25
Remove unnecessary nil checks before ranging over maps as
ranging over nil maps is safe in Go and will simply skip iteration.

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Collaborator

@kangoal kangoal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kangoal kangoal merged commit 1ee5af0 into main Jan 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants